<?php
App::uses('Szamla', 'Model');

class SzamlaTest extends CakeTestCase {
	public $fixtures = array('app.Szamla');
	
	public function setUp() {
		parent::setUp();
		$this->Szamla = ClassRegistry::init('Szamla');	//ezzel biztosítjuk, hogy használja az AB kapcsolatot
	}
	
	public function testGetSzamlaId(){
		$actual = $this->Szamla->getSzamlaId(511, array('ev' => 2012, 'cegId' => 2, 'szamlaSzam' => true));
		$expected = 2;
		$this->assertEquals($expected, $actual);

		$actual = $this->Szamla->getSzamlaId(1111, array('ev' => 2012, 'cegId' => 2, 'szamlaSzam' => true));
		$expected = false;
		$this->assertEquals($expected, $actual);

		$actual = $this->Szamla->getSzamlaId('511 Alapa', array('ev' => 2012, 'cegId' => 2));
		$expected = 2;
		$this->assertEquals($expected, $actual);

		$actual = $this->Szamla->getSzamlaId(999, array('ev' => 2012, 'cegId' => 2));
		$expected = 999;
		$this->assertEquals($expected, $actual);
	}
	
	public function testGetIdBySzam(){
		$actual = $this->Szamla->getIdBySzam(10, 2, 2012);
		$expected = 10;
		$this->assertEquals($expected, $actual);

		$actual = $this->Szamla->getIdBySzam("511 Alap és segédanyag költség", 2, 2012);
		$expected = 2;
		$this->assertEquals($expected, $actual);
	}

}
?>